package com.xuelang.pipeline.client.resource;

import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.resource.dto.ClusterDTO;
import com.xuelang.pipeline.client.resource.dto.ClusterQuery;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 集群服务API
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
public interface IClusterService {

    /**
     * 查询集群列表(有过滤条件，可以分页)
     *
     * @param dtoPageParam 查询条件
     * @return
     */
    @PostMapping(value = "/pageList", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<ClusterDTO>> pageClusterList(@RequestBody @Valid PageParam<ClusterQuery> dtoPageParam);

    /**
     * 查询集群列表(有过滤条件)
     *
     * @param clusterQuery 查询条件
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<ClusterDTO>> conditionalClusterList(@RequestBody @Valid ClusterQuery clusterQuery);

    /**
     * 新增集群
     *
     * @param clusterDTO 集群DTO
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> addCluster(@RequestBody @Valid ClusterDTO clusterDTO);

    /**
     * 更新集群
     *
     * @param clusterDTO 集群DTO
     * @return
     */
    @PutMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateCluster(@RequestBody @Valid ClusterDTO clusterDTO);

    /**
     * 删除集群
     *
     * @param clusterUuid 集群UUID
     * @return
     */
    @DeleteMapping(value = "/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteCluster(@PathVariable("uuid") String clusterUuid);
    /**
     * 查询集群
     *
     * @param clusterUuid 集群UUID
     * @return
     */
    @GetMapping(value = "/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<ClusterDTO> queryCluster(@PathVariable("uuid") String clusterUuid);

    /**
     * 是否存在关联交付空间限制
     *
     * @param clusterUuid 集群UUID
     * @return
     */
    @GetMapping(value = "/existsSpaceLimit/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> existsSpaceLimit(@PathVariable("uuid") String clusterUuid);
}
